<?php
require_once("inc.admin.php");

$this_title="$vars[admin_title] &raquo; ".__("Member Network");
$page_title=__("Member Network");

if(!$pv["task"]["Member Network"]){
 $errmsg="<h2>$page_title</h2>".format_err(__("You do not have the privilege to access member network."));
            
 print format_admin_page($errmsg, $this_title);
 exit();
}

//check user id and build matrix
if($_GET["uid"]){
 $user=get_user_detail_by_id($get_d["uid"]);
 if(!$user){
  $errmsg.=replace_tag(__("The Member ID '<%id%>' could not be found in the system."), array("<%id%>"=>$get_h['uid']))."<br />\n";
 }

 if(!$errmsg){
  //show member matrix
  $matrix = build_matrix_network($get_d["uid"], false, null, $get_d["uid"]);
  $matrix="<p class='bold'>".__("Matrix Network for Member ID").__(":")." $get_h[uid]<br />\n
  Member ID: $get_h[uid]'s Upline ID: ".($user["ref"]? $user["ref"] : "None")."<br />\n
  Member ID: $get_h[uid]'s Matrix Upline ID: ".($user["matrix_upline"]? $user["matrix_upline"]." Position: ".$user["matrix_position"] : "None")."</p>
  $matrix";
 }

 $errmsg=$errmsg? format_err($errmsg) : "";
}

$uid_entry=($errmsg?
$errmsg : "")."
<p>".__("To view a member matrix network, please provide the member ID at the below Member ID textbox.")."</p>
<form name='uid_form' method='get' action='$this_file?$_SERVER[QUERY_STRING]'>
<p>".__("Member ID").__(":")." <input type='text' name='uid' value=\"$get_h[uid]\" class='inputbox' />
<input type='submit' value=\"".__("Submit")."\" /></p>
</form>";

$content="
<h2>$page_title</h2>
$uid_entry
$matrix";
           
print format_admin_page($content, $this_title);
?>